<script type="text/javascript" src="../js/funcs.js"></script>
<?php
    require('/connect.php');
    $query="SELECT 
                fUser.First_Name as fF, fUser.Last_Name as fL, fUser.SID
            FROM 
                user as u, friends as f, user as fUser
            WHERE 
                u.sid=$id AND ((f.Friend1=u.sid AND fUser.sid=f.Friend2) 
                OR (f.Friend2=u.sid AND fUser.sid=f.Friend1));";
    $result=mysqli_query($con, $query);
    
    echo "<table>";
    echo "<th>Your current Circle</th>";
    $echoed = false;
    while($row = mysqli_fetch_assoc($result)){
        $sid = $row['SID'];
        $size=20;
        $f1F=$row['fF'];
        $f1L=$row['fL'];   
        echo "<tr class='hover'><td>$f1L, $f1F<a href=\"#\" onclick=\"removeFriend($sid);\">
              <img src='../images/delete.png' width='".$size."px' height='".$size."px'></a></td></tr>";
        $echoed=true;
    }
    
    if(!$echoed){
        echo "<tr class='hover'><td>You have no friends :-( <br />Start searching!</td></tr>";
    }
    echo "</table>";
    mysqli_close($con);
?>